package app.r_teenus.backend.model;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.springframework.transaction.annotation.Transactional;

@Entity
@Table(name="CONTACT")
public class Contact implements Serializable {

	private static final long serialVersionUID = 8963134677898479240L;
	
	private Integer id;
	private Integer subjectType;
    private Integer subject;
	private String valueText;
	private Integer orderBy;
	private String note;
	private ContactType contactType;
    private List<ContactType> allContactType = null;
    private Integer contactTypeId = null; 
	
    /**
     * Gets id (primary key).
     */
    @Id
    @Column(name = "CONTACT")
    @SequenceGenerator(name = "contact_id", sequenceName = "contact_id", allocationSize=1)
    @GeneratedValue(generator = "contact_id")
	public Integer getId() {
		return id;
	}
    
    /**
     * Sets id (primary key).
     */
	public void setId(Integer id) {
		this.id = id;
	}
	
	@Column(name = "SUBJECT_TYPE_FK")
	public Integer getSubjectType() {
		return subjectType;
	}
	public void setSubjectType(Integer subjectType) {
		this.subjectType = subjectType;
	}
	
	@Column(name = "SUBJECT_FK")
	public Integer getSubject() {
		return subject;
	}
	public void setSubject(Integer subject) {
		this.subject = subject;
	}
	
	@Column(name = "VALUE_TEXT")
	public String getValueText() {
		return valueText;
	}
	public void setValueText(String valueText) {
		this.valueText = valueText;
	}
	
	@Column(name = "ORDERBY")
	public Integer getOrderBy() {
		return orderBy;
	}
	public void setOrderBy(Integer orderBy) {
		this.orderBy = orderBy;
	}
	
	public String getNote() {
		return note;
	}
	public void setNote(String note) {
		this.note = note;
	}
	
    @OneToOne
    @JoinColumn(name="CONTACT_TYPE_FK", nullable=false)
	public ContactType getContactType() {
		return contactType;
	}
	public void setContactType(ContactType contactType) {
		this.contactType = contactType;
	}

	@Transient
	public List<ContactType> getAllContactType() {
		return allContactType;
	}

	public void setAllContactType(List<ContactType> allContactType) {
		this.allContactType = allContactType;
	}
	@Transient
	public Integer getContactTypeId() {
		return contactTypeId;
	}

	public void setContactTypeId(Integer contactTypeId) {
		this.contactTypeId = contactTypeId;
	}
}
